<template>
	<view class="copyApplay">
		<view class="copyApplayPadding">
				
				<!-- <view class="message">
					请准确填写相关信息并提交给医院审核！
				</view>
				<u-divider ></u-divider> -->
				
				<view>
						<!-- 注意，如果需要兼容微信小程序，最好通过setRules方法设置rules规则 -->
						<u--form
								labelPosition="left"
								labelWidth='100'
								:model="model1"
								:rules="rules"
								ref="uForm">
							<u-form-item
									label="申请类型"
									prop="userInfo.type"
									borderBottom>
								<u--input
										v-model="model1.userInfo.type"
										border="none"
										placeholder="请输入内容"
								></u--input>
							</u-form-item>
							<u-form-item
									label="患者姓名"
									prop="userInfo.name"
									borderBottom>
								<u--input
										v-model="model1.userInfo.name"
										border="none"
										placeholder="请输入内容"
								></u--input>
							</u-form-item>
							
							<u-form-item
									label="患者身份证号"
									prop="userInfo.cardNo"
									borderBottom>
								<u--input
										v-model="model1.userInfo.cardNo"
										border="none"
										placeholder="请输入内容"
								></u--input>
							</u-form-item>
							
							<u-form-item
									label="患者手机号"
									prop="userInfo.phone"
									borderBottom>
								<u--input
										v-model="model1.userInfo.phone"
										border="none"
										placeholder="请输入内容"
								></u--input>
							</u-form-item>
							
							
							<u-form-item
									label="住院号"
									prop="userInfo.zyh"
									borderBottom
									>
								<u--input
										v-model="model1.userInfo.zyh"
										disabled
										disabledColor="#ffffff"
										placeholder="请选择"
										border="none"
								></u--input>
							</u-form-item>
							
							<u-form-item
									label="出院科室"
									prop="userInfo.dept"
									borderBottom>
								<u--input
										v-model="model1.userInfo.dept"
										border="none"
										placeholder="请输入内容"
								></u--input>
							</u-form-item>
							
							<u-form-item
									label="出院日期"
									prop="userInfo.date"
									borderBottom>
									<u--input
											v-model="model1.userInfo.date"
											disabled
											disabledColor=''
											border="none"
											@click="dateShow = true"
									></u--input>
							</u-form-item>
							
							<u-form-item
									label="分数"
									prop="userInfo.num"
									borderBottom>
								<u--input
										v-model="model1.userInfo.num"
										border="none"
										placeholder="请输入内容"
								></u--input>
							</u-form-item>
							
							<u-form-item
									label="复印内容"
									prop="userInfo.typeContent"
									:customStyle="{height:'200upx'}">
								 <u--input
								 		v-model="model1.userInfo.typeContent"
								 		border="none"
								 		placeholder="请输入内容"
								 ></u--input>
							</u-form-item>
							
							<u-form-item
									label="备注"
									prop="userInfo.bz"
									borderBottom>
								 <u--input
								    disabled
									disabledColor=""
									placeholder="请输入内容"
									v-model="model1.userInfo.bz"
								  ></u--input>
							</u-form-item>
							<u-form-item
									label="申请事由"
									prop="userInfo.dec"
									>
									<u--input
											v-model="model1.userInfo.dec"
											disabled
											disabledColor=""
											placeholder="请选择"
											border="none"
									></u--input>
							</u-form-item>
							<u-form-item
									label="其他事由"
									prop="userInfo.decOther"
									v-if="decOtherShow"
									>
									<u--input
											v-model="model1.userInfo.decOther"
											disabled
											disabledColor=""
											placeholder="请选择"
											border="none"
									></u--input>
							</u-form-item>
							
							
							<view class="picTitle">
								上传患者本人身份证
							</view>
							<!-- 代理人申请 -->
							<u-form-item
								label=""
								v-if="isSelf"
								>
								
							</u-form-item>
							
						</u--form>	
					</view>
		</view>	
		
		
		<view class="submitBtn">
			<view class="btnBoxW" style="width: 90%;">
				<u-button   plain="true"   shape='circle' text="取消申请"></u-button>
				<u-button  type="primary" @click="copyBtn"  shape='circle' text="下一步"></u-button>
			</view>
		</view>
		
	</view>
	
</template>

<script>
	import{
		formatDate,
	}from '@/utils/index.js'
	export default{
		data(){
			return{
				type:'',
				current:0,
				dateShow:false,
				showDec:false,
				dateTime:this.$utils.formatDate(new Date()),
				showSex: false,
				decShow:false,
				decOtherShow:false,
				isSelf:false,
				model1: {
					userInfo: {
						type:'本人申请',
						name: '',
						cardNo:'',
						phone:'',
						zyh: '',
						dept:'',
						date:this.$utils.formatDate(new Date()),
						num:'',
						typeContent:[],
						dec:'',
						decOther:'',
						fileList:[],
						
					},
				},
				checkboxList1:[
					//病案首页，入院记录，出院记录，手术记录，病理报告，医学影像检查资料，体温单，医嘱单
					{
						name: '病案首页',
						disabled: false
					},
					{
						name: '入院记录',
						disabled: false
					},
					{
						name: '出院记录',
						disabled: false
					},
					{
						name: '手术记录',
						disabled: false
					},
					{
						name: '病理报告',
						disabled: false
					},
					{
						name: '医学影像检查资料',
						disabled: false
					},
					{
						name: '体温单',
						disabled: false
					},
					{
						name: '医嘱单',
						disabled: false
					}
				],
				actions: [{
					name: '111111',
					},
					{
						name: '222222',
					},
					{
						name: '333333',
					}
				],
				actionsDec:[{
					name: '请假',
					},
					{
						name: '报销',
					},
					{
						name: '其他',
					}],
				radiolist1: [
					{
				        name: '本人申请',
				        disabled: false
				    },
				    {
				        name: '患者代理人申请',
				        disabled: false
				    }
				],
				rules: {
					'userInfo.name': {
						type: 'string',
						required: true,
						message: '请填写姓名',
						trigger: ['blur', 'change']
					},
					'userInfo.cardNo': [
						{
							type: 'string',
							required: true,
							message: '请填写身份证号',
							trigger: ['blur', 'change']
						},
						{
							// 自定义验证函数，见上说明
							validator: (rule, value, callback) => {
								// 上面有说，返回true表示校验通过，返回false表示不通过
								// uni.$u.test.idCard()就是返回true或者false的
								return uni.$u.test.idCard(value);
							},
							message: '身份证号码不正确',
							// 触发器可以同时用blur和change
							trigger: ['change','blur'],
						}
					],
					'userInfo.phone':[
						{
							type: 'string',
							required: true,
							message: '请填写手机号',
							trigger: ['blur', 'change']
						},
						{
							// 自定义验证函数，见上说明
							validator: (rule, value, callback) => {
								// 上面有说，返回true表示校验通过，返回false表示不通过
								// uni.$u.test.mobile()就是返回true或者false的
								return uni.$u.test.mobile(value);
							},
							message: '手机号码不正确',
							// 触发器可以同时用blur和change
							trigger: ['change','blur'],
						}
						
					],
					'userInfo.zyh': {
						type: 'string',
						max: 1,
						required: true,
						message: '请选择住院号',
						trigger: ['blur', 'change']
					},
					'userInfo.dec': {
						type: 'string',
						max: 1,
						required: true,
						message: '请选择',
						trigger: ['blur', 'change']
					},
				},
				radio: '',
				switchVal: false
			}
		},
		methods: {
			sexSelect(e) {
				this.model1.userInfo.zyh = e.name
			},
			decSelect(e) {
				this.model1.userInfo.dec = e.name
				if(e.name == '其他'){
					this.decOtherShow = true
				}else{
					this.decOtherShow = false
				}
			},
			dateConfirm(val){
				this.model1.userInfo.date = this.$utils.formatDate(val.value);
				//console.log(val,this.$utils.formatDate(val.value),this.model1.userInfo.date);
				this.dateShow = false;
			},
			groupChange(n) {
				if(n == '本人申请'){
					this.isSelf = false
				}else{
					this.isSelf = true
				}
			    console.log('groupChange', n);
			},
			
			copyBtn(){
				uni.navigateTo({
					url:'/pages/address/address'
				})
			}
			
			
			
		},
		onReady() {
			//如果需要兼容微信小程序，并且校验规则中含有方法等，只能通过setRules方法设置规则。
			this.$refs.uForm.setRules(this.rules)
		}
		
	}
	
	
	
</script>

<style scoped lang="scss">
	.copyApplay{
		.copyApplayPadding{
			padding: 20upx;
			padding-bottom: 120upx;
			box-sizing: border-box;
			
			.message{
				font-size: 24upx;
				/* margin-top: 20upx; */
				/* padding: 20upx;
				box-sizing: border-box; */
			}
			.info{
				color: #e27f04;
				font-size: 24upx;
			}
			.uploadInfo{
				text-align: center;
			}
			.picTitle{
				color: #303133;
				font-size: 15px;
			}
			
		}
		
	}
	::v-deep .u-upload__wrap{
		align-items: center;
		justify-content: center;
	}
	
	
</style>